/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Source;

import java.io.*;
import java.net.*;
import java.util.ArrayList;

/**
 * Sends a request to the server and returns the reply
 * @author Samuel Millar 
 */
public class FlightServerInteraction {
    private static final int SOCKET_NUMBER = 3120;
    private static final String SERVERADDRESS = "";
    /**
 *
 * @parmam request the request for the server
     * @return  reply the reply from the server
 */
    
    public ArrayList run(ArrayList<String> request) {
        ArrayList<String> reply = new ArrayList<String>();
        ObjectInputStream ois = null;
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        Socket socket = null;
        try {
            socket = new Socket(SERVERADDRESS, SOCKET_NUMBER);
            ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
            ois = new ObjectInputStream(socket.getInputStream());
            out.writeObject(request);
            reply = (ArrayList<String>)ois.readObject();
        }
        catch (Exception e){
            System.out.println(e.getMessage() + "\n");
        }
        return reply;
    }
}

